//
//  ContactsSDK.m
//  MFWebBrowser
//
//  Created by Dream on 2018/7/26.
//  Copyright © 2018年 Dream. All rights reserved.
//

#import "ContactsSDK.h"
#import "ContactsViewController.h"


#define CAWeakObj(o) __weak typeof(o) o##Weak = o
#define CAStrongObj(o) __strong typeof(o) o = o##Weak

@implementation ContactsSDK

- (void)showContactsView:(UIViewController *)fromVC delegate:(id<ContactsDelegate>)delegate
{
    ContactsViewController *vc = [[ContactsViewController alloc] init];
    
    if (fromVC.navigationController) {
        
        [fromVC.navigationController pushViewController:vc animated:YES];
    }
    else {
        
        [fromVC presentViewController:vc animated:YES completion:nil];
    }
    
    
    //所有的通讯录数据
    vc.ContactsBlock = ^(NSArray *contacts) {
        
        if ([delegate respondsToSelector:@selector(uploadContacts:)]) {
            
            [delegate uploadContacts:contacts];
        }
        
    };
}

@end
